-
Notifications
You must be signed in to change notification settings - Fork 83
Add support for quote reactions and improve quote detection #2330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Introduces a new 'quote' comment type, updates interaction handling to extract and process quote links from content, and enhances reply detection to recognize quote-inline patterns. Includes comprehensive tests for quote extraction and reply identification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for quote comments in the ActivityPub plugin by adding detection and handling of quote-inline patterns commonly used by Mastodon and other Fediverse platforms. It enhances the reply detection system to recognize quote patterns and processes them as a new comment type.
- Adds a new 'quote' comment type with appropriate metadata and translations
- Implements quote link extraction from HTML content with regex pattern matching
- Enhances reply detection to recognize quote-inline patterns in addition to standard inReplyTo properties
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/phpunit/tests/includes/collection/class-test-interactions.php | Adds comprehensive tests for quote link extraction and quote comment creation |
| tests/phpunit/tests/includes/class-test-functions.php | Adds tests for enhanced reply detection including quote-inline pattern recognition |
| includes/functions.php | Updates is_activity_reply function to detect quote-inline patterns |
| includes/collection/class-interactions.php | Implements extract_quote_link method and integrates quote handling into comment creation |
| includes/class-comment.php | Registers new 'quote' comment type and updates descriptions for existing comment types |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Split the validation in add_comment() to separately check for valid comment data and the presence of 'inReplyTo'. This improves code clarity and ensures early return if comment data is invalid.
Introduces a 'display_style' property to comment type definitions, distinguishing between 'facepile' and 'comment' display styles. Adds helper methods to check if a comment type should be shown as a facepile and to retrieve all facepile types, enabling more flexible comment rendering.
|
What do you think of this idea? When a QuoteRequest activity is received, it’s stored in the In the case of Misskey quotes, when the https://docs.akkoma.dev/stable/development/ap_extensions/#quote-posts
|
|
Close it for now and see how the Reader might help. |
Eliminated the 'display_style' property from comment type definitions and removed related methods for determining and retrieving facepile types. This simplifies comment type handling by no longer distinguishing between facepile and comment display styles.
Introduces comprehensive PHPUnit tests for the esc_hashtag function, including a data provider with various input cases, filter hook behavior, HTML escaping, and handling of quoted strings. These tests ensure correct hashtag formatting, proper escaping, and extensibility via filters.
Replaces the use of the translation function for 'description' fields in activity types (Reposts, Likes, Quotes) with plain strings. This change may be intended to simplify or standardize these descriptions, possibly because translation is not needed for these fields.
|
@obenland forgot to add the new attributes, that's why they were not added to the inbox. I changed the code to work with the quote attribute (and fallbacks). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Corrects the condition for converting camelCase to snake_case in Generic_Object by checking for underscore prefix using str_starts_with. Adds and expands PHPUnit tests for handling quote and underscore-prefixed properties in Base_Object, including round-trip set/get tests.
Refactored the function is_activity_quote to is_quote_activity for improved naming consistency. Updated all references and related tests to use the new function name.
Corrects the condition to convert camelCase to snake_case only for keys not prefixed with '_', ensuring proper key formatting in the Generic_Object class.
Changed @Covers annotations in class-test-generic-object.php to use the fully qualified class name Activitypub\Activity\Generic_Object for improved clarity and accuracy in test coverage reporting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The 'quote' comment type is now included alongside 'like' and 'repost' in the Jetpack integration. This expands supported ActivityPub comment types.
Introduces a new 'quote' comment type, updates interaction handling to extract and process quote links from content, and enhances reply detection to recognize quote-inline patterns. Includes comprehensive tests for quote extraction and reply identification.
supersedes #2303
Proposed changes:
Other information:
Testing instructions:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Added support for quote comments, improving detection and handling of quoted replies and links in post interactions.